#include <Windows.h>
#include "SquaresGame.h"
#pragma warning(disable:4099) //turns off the LNK-errors for no .pdb file with the SFML libs
#pragma warning(disable:4007) //WinMain

SquaresGame::SquaresGame(unsigned int width, unsigned int height)
	: GameBase(width, height)
{
	_State = MENU;
}
SquaresGame::~SquaresGame()
{

}

void SquaresGame::Logic()
{
	switch(_State)
	{
		case GAME: UpdateGameState(); break;
		case MENU: UpdateMenuState(); break;
		case HIGHSCORES: UpdateHighscoresState(); break;
	}
}
void SquaresGame::OnRender()
{
	switch(_State)
	{
		case GAME: DrawGameState(); break;
		case MENU: DrawMenuState(); break;
		case HIGHSCORES: DrawHighscoresState(); break;
	}
}
// ***************************************
// Helper Functions
bool SquaresGame::LoadTexture(String file, Texture *texture, IntRect position = IntRect(0,0,0,0))
{
	texture = new Texture();
	if(!texture->loadFromFile(file, IntRect(0, 0, 800, 600)))
		return false;

	return true;
}


// ***************************************
// Loading
bool SquaresGame::OnLoad()
{
	//Loading stuff goes here ...
	if(!LoadTexture("Assets\MenuBackground.tga", _menuBackground, IntRect(0,0,800,600)))
	{
		MessageBox(NULL, L"Couldnt Load Menu Background", L"Error Loading assets", NULL);
		return false;
	}

	return true;
}

// ***************************************
// Menu Functions
void SquaresGame::DrawMenuState()
{

}
void SquaresGame::UpdateMenuState()
{

}

// ***************************************
// Game Functions
void SquaresGame::DrawGameState()
{

}
void SquaresGame::UpdateGameState()
{

}

// ***************************************
// HighScore Functions
void SquaresGame::UpdateHighscoresState()
{

}
void SquaresGame::DrawHighscoresState()
{

}

int WinMain(HINSTANCE hInstance, HINSTANCE hPrev, LPSTR cmdLine, int cmdShow)
{
	SquaresGame Game(800, 600);
	if(!Game.Start())
		return 1;

	return 0;
}